package com.itheima.day815.demo03;

public class Father {
    public Father (int a){
        super();
        System.out.println("Father---带参构造");
    }

    public void method01() { }
    private void method02() { }
    public static void method03() { }
    //注意当我们不写权限修饰符时,表示采用默认权修饰
    protected void method04(){}
    public Father method05(){
        return new Father(2);
    }
}
class Zi extends Father {
    @Override
    public void method01() { }

   /* @Override   //父类中私有的方法不能被重写
    private void method02() { }
    @Override   //父类中静态的方法不能被子类重写
    public static void method03() { }*/

    //子类重写父类方法 要求子类方法权限必须大于等于父类权限
    @Override
    protected void method04(){}
    public Zi (){
        super (10);
        System.out.println("Zi---无参构造");
    }
    public Zi (int a){
        super(a);
        System.out.println("\"Zi---带参构造\"");
    }

    //子类重写父类方法 要求子类方法返回值类型和父类相等,或者是父类返回值类型的子类型
    @Override
    public Father method05(){
        Zi zi = new Zi();
        return zi;
    }

}


